<h1>Edit Article</h1>

<p>Update this article!</p>

<%= render :partial => 'form/errors', :locals => { :record => @article } %>

<% form_for :article, :url => article_url(@article), :html => { :method => :put } do |form| %>
  <%= form.text_field :title %>
  <%= form.text_area  :body  %>
  <%= form.text_field :tag_list  %>
  <% if current_user.login == 'admin' %>
  <%= form.select :blog_id, Blog.find(:all).collect {|b| [ b.title, b.id ] }, { :include_blank => false }, :selected => @article.blog %>
  <% else %>
  <%= form.select :blog_id, Blog.find(:all, :conditions => ["user_id = ?", @article.user]).collect {|b| [ b.title, b.id ] }, { :include_blank => false }, :selected => @article.blog %>
  <% end %>
  
  <%= form.submit 'Save article' %>
<% end %>